/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sais.noisylibrary.card;

/**
 *
 * @author Romulus
 */
public class SpellCard extends Card {

    private int mPoint;
    private int[] mCost = new int[]{0, 0, 0, 0, 0};

    public SpellCard(String... data) {
        mType = SPELL;
        mName = data[1];
        mPoint = Integer.parseInt(data[3]);
        for (char c : data[4].toCharArray()) {
            ++mCost[ATTRIBUTES.indexOf(c)];
        }
    }

    @Override
    public String toString() {
        return mPoint + "点 | " + getCostString() + " | " + mName;
    }

    public String getCostString() {
        StringBuffer ret = new StringBuffer();
        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < mCost[i]; ++j) {
                ret.append(ATTRIBUTES.charAt(i));
            }
        }
        return ret.toString();
    }

    public int getPoint() {
        return mPoint;
    }

    public int[] getCostArray() {
        return mCost;
    }

}
